package achi.community.irla.beans;

//import DatabaseImpl;
import achi.community.irla.database.*;
import achi.community.irla.entities.Messages;
//import achi.community.irla.entities.Messages_users;
import achi.community.irla.entities.Users;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import achi.community.irla.database.ModelBean;
import javax.faces.bean.ManagedProperty;

/**
 * ModelBean:
 * Contains logged in customers, choosen shop category
 * Retrive all animals of a specific type(to shop.xhtml)
 * Get data of one animal in DB(to animal.xhtml)
 */
@ManagedBean
@SessionScoped
public class SettingsModelBean implements Serializable {

    @EJB
    DatabaseImpl db;
    private Users user;

    private String firstname;
    private String lastname;
    private String username;
    private String email;

    @ManagedProperty(value = "#{modelBean}")
    ModelBean modelBean;

    public ModelBean getModelBean() {
        return modelBean;
    }

    public void setModelBean(ModelBean modelBean) {
        this.modelBean = modelBean;
    }

    public void setUser(Users user) {
        this.user = user;
    }

    public Users getUser() {
        user = modelBean.getUser();
        return user;
    }

    public String getEmail() {
        return email;
    }

    public String getFirstname() {
        return firstname;
    }

    public String getLastname() {
        return lastname;
    }

    public String getUsername() {
        return username;
    }

    public void setEmail(String email) {
        this.email = user.getEmail();
    }

    public void setFirstname(String firstname) {
        this.firstname = user.getFirstName();
    }

    public void setLastname(String lastname) {
        this.lastname = user.getLastName();
    }

    public void setUsername(String username) {
        this.username = user.getUsername();
    }
}
